/*********************************************************
	Project:		ST FST(TDA7540)
	File name:	RDS.h
	Description:	
	Write/Modify:	Perry Liang
	Time:		2006-1-24- 15:35:56
*********************************************************/

extern void RDSInit(void);
extern void RDSMain(void);
///extern void RDSKey(void);
extern void RDSDisplay(void);
extern void SwitchToTa(void);
extern void TaSwitchBack(void);
extern void SwitchToEONTa(void);
extern void EONTaSwitchBack(void);
extern void RDSTimer100ms(void);

extern void AFSPin(unsigned char AFSmode);
extern uchar ReadRDSDataPin(void);
extern void Disable_RDS_Int(void);
extern void Enable_RDS_Int(void);

#ifdef NEW_MAINBOARD
#define PD_RDSDATA		PC_DDR0
#define PCR1_RDSDATA		PC_CR10
#define PCR2_RDSDATA		PC_CR20
#define PinIn_RDSDATA		PC_IDR0
#define Pout_RDSDATA		PC_ODR0

#define PD_RDSCLK		PC_DDR1
#define PCR1_RDSCLK		PC_CR11
#define PCR2_RDSCLK		PC_CR21
#define PinIn_RDSCLK		PC_IDR1

#define PD_AFS			PH_DDR7
#define PCR1_AFS			PH_CR17
#define PCR2_AFS			PH_CR27
#define Pin_AFS			PH_ODR7
#elif defined COSTDOWN_MAINBOARD
#define PD_RDSDATA		PC_DDR2
#define PCR1_RDSDATA	PC_CR12
#define PCR2_RDSDATA	PC_CR22
#define PinIn_RDSDATA	PC_IDR2
#define Pout_RDSDATA	PC_ODR2

#define PD_RDSCLK		PC_DDR1
#define PCR1_RDSCLK		PC_CR11
#define PCR2_RDSCLK		PC_CR21
#define PinIn_RDSCLK	PC_IDR1

#define PD_AFS			PB_DDR0
#define PCR1_AFS		PB_CR10
#define PCR2_AFS		PB_CR20
#define Pin_AFS			PB_ODR0
#else
#define PD_RDSDATA		PH_DDR2
#define PCR1_RDSDATA		PH_CR12
#define PCR2_RDSDATA		PH_CR22
#define PinIn_RDSDATA		PH_IDR2
#define Pout_RDSDATA		PH_ODR2

#define PD_RDSCLK		PD_DDR3
#define PCR1_RDSCLK		PD_CR13
#define PCR2_RDSCLK		PD_CR23
#define PinIn_RDSCLK		PD_IDR3

#define PD_AFS			PG_DDR4
#define PCR1_AFS			PG_CR14
#define PCR2_AFS			PG_CR24
#define Pin_AFS			PG_ODR4
#endif

ext unsigned char RDSDispTimer;
ext unsigned char RDSDispMode;
#define RDSDISP_IDLE		0
#define RDSDISP_PS			1
#define RDSDISP_TRAFFIC		2
#define RDSDISP_PTY			3
#define RDSDISP_PTYSELECT	4

#define RDSDISP_SDLEVEL		5
#define RDSDISP_AFLIST		6

#define RDSDISP_FMAGC			7
#define RDSDISP_AMWAGC			8
#define RDSDISP_AMNAGC			9
#define RDSDISP_SLIDING			10
#define RDSDISP_SOFTMUTE		11
#define RDSDISP_MAXMUTE			12
#define RDSDISP_SENSITIVITY		13
#define RDSDISP_DETUNING		14
#ifdef SHOW_RDS_PS_LIST
#define SEEK_MODE_NONE  0
#define SEEK_MODE_PI    1
#define SEEK_MODE_TA    2
#endif
ext unsigned int  AutoTASeekTimer;
ext unsigned char AFTAShowTimer;
ext uword PTYSelectTimer;
ext unsigned char InTADelayTimer;
ext unsigned char TAWaitAFCheckTimer;
ext unsigned char EnterTADelayTimer;
ext unsigned char EnterEONTADelayTimer;

ext UCharField RDSFlag;
#define F_InTASwitch		RDSFlag.field.B0
#define F_PTYSelect			RDSFlag.field.B1
#define F_NoPTY				RDSFlag.field.B2
#define F_RDSDispReq		RDSFlag.field.B3
#define F_InEONTASwitch		RDSFlag.field.B4
#define F_SwitchToTAVolume  RDSFlag.field.B5
//#define F_TrafficLCDDisp	RDSFlag.field.B6
#ifdef SHOW_RDS_PS_LIST
ext unsigned char PSListCnt;
ext unsigned char PSListTimer;
ext unsigned int PISeekSTTimer;
ext unsigned int PISeekPIdifTimer;
#endif
ext uword Af_Radio_Bk;
ext unsigned char PTYSelectType;
ext uchar Rds_Detect_Timer;
///ext unsigned int year;
///ext unsigned char month;
///ext unsigned char date;

ext UCharField UIcon;
ext unsigned char BcIcon;
#define F_DISP_AF				UIcon.field.B0
#define F_DISP_TA				UIcon.field.B1
#define F_DISP_TP				UIcon.field.B2
#define F_DISP_REG				UIcon.field.B3
#define F_DISP_PTY				UIcon.field.B4
#define F_DISP_EON				UIcon.field.B5

#if D_RDS_PSSAVE

extern void ClrDispPSArray(void);
extern void RDSPSInit(void);
extern void WritePStoEEP(uchar eepaddr);
extern void SaveCurrentPS(uchar BandAddress);
extern void LoadCurrentPS(uchar BandAddress);
extern void ClrBandPresetPS(void);
extern void ClrAllBandPS(void);
void ClrCurrentPS(void);



#endif
extern uchar Rds_CheckNewPs_Exit(void);


/*********************************************************
				File End
*********************************************************/

